<template>
  <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      fixed
      prop="id"
      label="id"
      width="150">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="120">
    </el-table-column>
    <el-table-column
      prop="passwd"
      label="密码"
      width="120">
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
        <el-button type="text" size="small">编辑</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>


<script>
import request from '../utils/request';


export default {
  created() {
    let _this = this
    request.get("/ user/list").then(res =>{
      console.log(res)
      _this.tableData = res.data
    })

    // axiox.get 方法 
    // axios.get("http://localhost:8081/user/list").then(function (resp){
    //   console.log(resp)
    //   _this.tableData=resp.data

    // })
  },
  methods:{
    handleClick(row){
      this.$router.push("/main")
    }
  },
  data() {
    return {
      tableData: []
    }
  }
}
</script>
